<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
	<title>用户信息</title>
	<%@include file="/common/jsp/taglib.jsp"%>
	
	
	<script type="text/javascript">
		
	
	$(function(){
		
	});
	

	function submitform(){

		if(!stringCheck($("#name").val())){
			common.alertMes("用户名称不合法",null);
			return false;
		}
		if(!stringCheck($("#loginname").val())){
			common.alertMes("用户登录名不合法",null);
			return false;
		}
		if(!stringCheck($("#pwd").val())){
			common.alertMes("用户密码不合法",null);
			return false;
		}

		var d1 = $("#userform").serialize();
		var url = ctx + "basic/saveUser.do";
		console.info(d1);
		common.dajax(url, d1, function(d){
			if("ok"==d.ok){
				var url2 = ctx + "common/s.do";
				var param = {
					statement: '${statement}',
					tourl: '${tourl}'
				};
				common.loadPage(url2,param);
				return ;
			}else{
				common.alertMes(d.ok, null);
				return ;
			}
		});
		
		return ;
		
	}
	
	
	</script>
</head>
<body>
				<!-- 主体内容开始 -->
				<div class="row">
					<div class="col-lg-12">
						<section class="panel">
 							<header class="panel-heading">
 								<div class=" alert-info" ><strong>
 								新建用户
 								</strong></div>
 							</header> 
							<div class="panel-body">
								<form class="form-horizontal tasi-form" role="form" id="userform" >
									<div class="form-group"> 
                                          <label class="col-sm-2 col-sm-2 control-label"><b>用户姓名</b></label>
                                          <div class="col-sm-10">
                                              <input type="text" id="name" name="name" class="form-control" required> 
                                          </div>
                                    </div>
                                    <div class="form-group"> 
                                          <label class="col-sm-2 col-sm-2 control-label"><b>登录名</b></label>
                                          <div class="col-sm-10">
                                              <input type="text" id="loginname" name="loginname" class="form-control" required> 
                                          </div>
                                    </div>
                                    
                                    <div class="form-group"> 
                                          <label class="col-sm-2 col-sm-2 control-label"><b>密码</b></label>
                                          <div class="col-sm-10">
                                              <input type="text" id="pwd" name="pwd" class="form-control" required> 
                                          </div>
                                    </div>
									
									<div class="form-group"> 
                                          <label class="col-sm-2 col-sm-2 control-label"><b>角色</b></label>
                                          <div class="col-sm-10">
                                              <c:forEach var="p" items="${roles }" varStatus="ind">
												<input type="checkbox" name="roles" id="${p.id}" value="${p.id}" /><label for="${p.id}" >${p.name}</label>
												&nbsp;&nbsp;&nbsp;&nbsp;


												</c:forEach>

                                          </div>
                                    </div>


									<div class="form-group"> 
                                          <label class="col-sm-2 col-sm-2 control-label"><b>手机号</b></label>
                                          <div class="col-sm-10">
                                              <input type="text" id="phoneno" name="phoneno" class="form-control" required> 
                                          </div>
                                    </div>
                                    <div class="form-group"> 
                                          <label class="col-sm-2 col-sm-2 control-label"><b>邮箱</b></label>
                                          <div class="col-sm-10">
                                              <input type="text" id="email" name="email" class="form-control" required> 
                                          </div>
                                    </div>


                                    
									
									<div class="form-group text-center">
										<input type="hidden" name="uid" value="0" />
										<input type="hidden" name="statement" value="${statement }"  />
										<input type="hidden" name="tourl" value="${tourl }"  />
										<input type="hidden" name="organizationid" value="${organizationid }" />
										<button type="button" class="btn btn-info" onclick="submitform();"><i class="icon-ok"></i><b>&nbsp;提 交</b></button> 
										<button type="button" class="btn btn-info" onclick="common.backToList();"><i class="icon-reply"></i><b>&nbsp;返 回</b></button> 
									</div>
								</form>
							</div>
						</section>
					</div>
				</div>
				<!-- 主体内容结束 -->
</body>
</html>